import { stringify } from 'qs';
import request from '@/utils/request';

export async function queryProductModel(params) {
  return request(`/api/productmodels?${stringify(params)}`);
}
export async function add(params) {
  return request('/api/productmodels', {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
export async function edit(params) {
  return request('/api/productmodels', {
    method: 'PUT',
    body: {
      ...params,
    },
  });
}
export async function del(params) {
  return request(`/api/productmodels/${params}`, {
    method: 'DELETE',
  });
}
export async function qryById(params) {
  return request(`/api/productmodels/${params}`, {
    method: 'GET',
  });
}

export async function queryProductModelProperty(params) {
  return request(`/api/productmodels/properties?${stringify(params)}`);
}

export async function qryUnitList() {
  return request(`/api/productmodels/properties/units`);
}
export async function qryDataTypeList() {
  return request(`/api/productmodels/properties/datatypes`);
}
export async function addProperty(params) {
  return request('/api/productmodels/properties', {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

export async function qryPropertyDetail(params) {
  return request(`/api/productmodels/properties/${params}`, {
    method: 'GET',
  });
}
export async function editProperty(params) {
  return request('/api/productmodels/properties', {
    method: 'PUT',
    body: {
      ...params,
    },
  });
}
export async function delProperty(params) {
  return request(`/api/productmodels/properties/${params}`, {
    method: 'DELETE',
  });
}
